package com.cts.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cts.model.vo.IntroductionVO;
import com.cts.service.SiteSettingService;
import com.cts.entity.SiteSetting;
import com.cts.mapper.SiteSettingMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
* @author tongshengchen
* @description 针对表【site_setting】的数据库操作Service实现
* @createDate 2023-02-06 12:25:57
*/
@Service
public class SiteSettingServiceImpl extends ServiceImpl<SiteSettingMapper, SiteSetting>
    implements SiteSettingService {

    @Autowired
    SiteSettingMapper siteSettingMapper;

    @Override
    public List<SiteSetting> getSiteSetting(Integer type) {
        List<SiteSetting> siteSettingList = siteSettingMapper.getSiteSetting(type);
        return siteSettingList;
    }

    @Override
    public Map<String, String> getIntroduction() {
        List<IntroductionVO> introduction = siteSettingMapper.getIntroduction();
        Map<String, String> introductionMap = introduction.stream().collect(Collectors.toMap(IntroductionVO::getNameEn, IntroductionVO::getValue, (key1, key2) -> key2));
        return introductionMap;
    }
}




